<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		2，通过代码完成两个数的交换，至少使用两种方式
		<script type="text/javascript">
			let x = 1;
			let y = 8;
			//方式一，换两杯水用三个杯子
			let temp = x;
			x = y;
			y = temp;
			console.log(x,y);
			//方式二，+-法
			x = x + y;
			y = x - y;
			x = x - y;
			console.log(x,y);
			//方式三，位运算符
			x = x ^ y;
			y = x ^ y;
			x = x ^ y;
			console.log(x,y);
		</script>
	</body>
</html>
